<?php
/*------------------------------------------------------------------------
 * SchoolsController.class.php 
 *
 * 创业学院	
 * 	
 * Created on 2015-12-16
 *
 * Author: hwc123 <hwc123@139.com>
 * 
 * Copyright (c) 2015 http://www.qingtajiao.com All rights reserved.
 * ------------------------------------------------------------------------
 */

namespace Home\Controller;
class SchoolsController extends CommonController{
	public $module = 'schools';

	public function _initialize(){
		parent::_initialize();
		$this->add_step('创业学院', URL('index'));
	}
	// 列表页面
	public function index(){
		$where['module'] = $this->module;
		$list = D('Article')->get_list($where, '', $this->_get('p', '', 1));
		//处理AJAX分页
		$this->ajax_page($list, D('Article')->count);
		// 创业学院活动公告banner
		$banner = D('Banner')->get_list($this->module);

		$this->assign('list', $list);
		$this->assign('banner', $banner);
		$this->assign('notice_content', D('Article')->get_page_content('notice_schools'));
		$this->display();
	}
	// 详情
	public function detail(){
		$article_id = $this->_get('article_id', '对不起，您的操作有误！');
		$info = D('Article')->info($article_id);
		$this->add_step($info['title']);
		// 相关关键字
		$related_keyword = $info['related_keyword'];
		// 更新查看次数
		D('Article')->update_view_num($article_id, $this->user_id, session_id());

		$this->assign('related_article_list', $this->related_article_list($related_keyword, $article_id));// 相关文章
		$this->assign('notice_content', D('Article')->get_page_content('notice_schools'));// 公告
		$this->assign('info', $info);
		$this->display();
	}
	// 相关文章
	private function related_article_list($keyword = '', $article_id = ''){
		$list = D('Article')->related_article_list($this->module, $keyword, $article_id);
		return $list;
	}
}